home *** CD-ROM | disk | FTP | other *** search
- // Fireworks Dreamweaver 2.0 Library imagemap output.
- // Version 2.0 24JAN99
-
-
- // To export HTML without comments change the value of variable doComments to "false".
- var doComments=true;
-
- // When doComments is set to "true" the WRITE_HTML_COMMENT and WRITE_JS_COMMENT functions
- // include HTML and JavaScript in the exported file.
- function WRITE_HTML_COMMENT(str) {
- if (doComments) WRITE_HTML("<!--"+str+"-->\n");
- }
-
- function WRITE_JS_COMMENT(str) {
- if (doComments) WRITE_HTML("/* "+str+" */\n");
- }
-
- WRITE_HTML("\n")
-
- WRITE_HTML("\n");
-
- // Write HTML target and date created.
- var d = new Date();
- WRITE_HTML("<!-- Fireworks 2.0 Dreamweaver 2.0 Library target. \n Created ", d, " -->\n");
- WRITE_HTML("\n")
-
- // Declare variables for processing Behaviors.
- var hasImagemap = false;
- var hasStatusMessages = false;
-
- var kActionStatusMessage = 1;
- var kActionSwapImage = 2;
- var kActionRadioGroup = 3;
-
- var kEventMouseOver = 0;
- var kEventOnClick = 1;
- var kEventMouseOut = 2;
-
- // Write a client-side imagemap
- if (exportDoc.clientMap) {
- var i = 0;
- while (i < imagemap.numberOfURLs) {
- hasImagemap = true; // at least 1 url in the imagemap.
- for (var j=0; j<imagemap[i].behaviors.numberOfBehaviors; j++) {
- var curBehavior = imagemap[i].behaviors[j];
- if (curBehavior.action == kActionStatusMessage) {
- hasStatusMessages = true;
- }
- }
- i++;
- }
- if (exportDoc.hasBackgroundLink) {
- hasImagemap = true;
- }
- }
-
- /* Note: In simple imagemaps using the template Imagemap.htt, the only available
- behavior is the status bar message. Otherwise, the Slices.htt template is used. */
- function ProcessBehavior(theCurBehaviors) {
- var gotJavascript = false;
- var overStat = false;
- var hitStat = false;
- var outStat = false;
- var eraseStatOnRestore = false;
- for (var i=0; i<theCurBehaviors.numberOfBehaviors; i++) {
- var curBehavior = theCurBehaviors[i];
- var curJavascript = "";
- var gotStat = false;
- if (curBehavior.action == kActionStatusMessage) {
- gotJavascript = true;
- gotStat = true;
- var statMsg = curBehavior.statusText;
- var restore = curBehavior.restoreOnMouseout;
- curJavascript += "MM_displayStatusMsg('" + statMsg + "');";
- if (restore) {
- eraseStatOnRestore = true;
- }
- } else {
- continue;
- }
- if (curBehavior.event == kEventMouseOver) {
- javaOver += curJavascript;
- if (gotStat) overStat = true;
- }
- if (curBehavior.event == kEventMouseOut) {
- javaOut += curJavascript;
- if (gotStat) outStat = true;
- }
- if (curBehavior.event == kEventOnClick) {
- javaClick += curJavascript;
- if (gotStat) hitStat = true;
- }
- }
- if (eraseStatOnRestore) {
- javaOut += "MM_displayStatusMsg(' ');" ;
- outStat = true;
- }
- var ret = "return document.MM_returnValue";
- if (overStat) javaOver += ret;
- if (outStat) javaOut += ret;
- if (hitStat) javaClick += ret;
- return(gotJavascript);
- }
-
-
- // If a server-side image map is being export, write commented not on replacing file path.
- if (exportDoc.serverMap) {
- WRITE_HTML("<!-- ----------------------------------- NOTE ---------------------------------- --->\n");
- WRITE_HTML("<!-- Replace the text in the following HREF tag with the path to your map file's -->\n");
- WRITE_HTML("<!-- location on the server. The \"", exportDoc.pathBase, ".map\" file generated by Fireworks needs to be -->\n");
- WRITE_HTML("<!-- placed in a directory with a CGI Application capable of interpreting the Image -->\n");
- WRITE_HTML("<!-- Map information. If you are unsure about this, contact your web site -->\n");
- WRITE_HTML("<!-- administrator. -->\n");
- WRITE_HTML("\n");
-
- // Generate link to image map file.
- WRITE_HTML("<a href=\"path_to_map_file/", exportDoc.pathBase, ".map\">\n");
- }
-
- // Write image tag.
- WRITE_HTML("<img src=\"", exportDoc.filename,"\" ");
-
- WRITE_HTML("width=\"", exportDoc.width, "\" height=\"", exportDoc.height, "\"");
- if (hasImagemap) {
- WRITE_HTML(" usemap=\"#", exportDoc.imagename, "\"")
- }
- if (exportDoc.serverMap) {
- WRITE_HTML(" ismap");
- }
-
- WRITE_HTML(" border=\"0\" >\n");
-
- if (exportDoc.serverMap) {
- WRITE_HTML("</a>\n");
- }
-
- WRITE_HTML("\n");
-
- // Write client-side image map.
- if (hasImagemap) {
- WRITE_HTML("<map name=\"", exportDoc.imagename, "\">\n");
-
- var i = 0;
- while (i < imagemap.numberOfURLs) {
- var curImagemap = imagemap[i];
- var behaviors = curImagemap.behaviors;
- var javaOver = "";
- var javaOut = "";
- var javaClick = "";
- var gotJavascript = ProcessBehavior(behaviors);
-
- // Write the area tag with shape definitions.
- WRITE_HTML("<area shape=\"");
- WRITE_HTML(curImagemap.shape); // Shapes are rect poly and circle
- WRITE_HTML("\" coords=\"");
- for (var j=0; j<curImagemap.numCoords; j++) {
- if (j>0) WRITE_HTML(",");
- // polygon has n coords.
- // rect has 2 coords, topLeft, and botomRight.
- // Circle has one coord, center; plus radius.
- WRITE_HTML(curImagemap.xCoord(j), ",", curImagemap.yCoord(j));
- }
- if (curImagemap.shape == "circle") {
- // Write the radius for circle hotspots.
- WRITE_HTML(", ", curImagemap.radius);
- }
- WRITE_HTML("\"");
- var href = " href=\"#\"";
- if (curImagemap.hasHref) {
- href = " href=\"";
- href += curImagemap.href;
- href += "\"";
- if (curImagemap.hasTargetText) {
- href += " target=\"";
- href += curImagemap.targetText;
- href += "\"";
- }
- }
-
- // Write status bar message behaviors.
- if (javaOut != "") {
- WRITE_HTML(" onMouseOut=\"", javaOut, "\" ");
- }
- if (javaOver != "") {
- WRITE_HTML(" onMouseOver=\"", javaOver, "\" ");
- }
- if (javaClick != "") {
- WRITE_HTML(" onClick=\"", javaClick, "\" ");
- }
- WRITE_HTML(href);
-
- // Write alt text for hotspot.
- var altText = "";
- if (curImagemap.hasAltText) {
- altText = curImagemap.altText;
- } else {
- altText = exportDoc.altText;
- }
-
- if (altText!="") {
- WRITE_HTML(" title=\"", altText, "\"");
- WRITE_HTML(" alt=\"", altText, "\"");
- }
-
- WRITE_HTML(" >\n");
- i++;
- }
-
- // Write the image's default URL here.
- if (exportDoc.hasBackgroundLink && exportDoc.backgroundLink.href != "") {
- var curImagemap = exportDoc.backgroundLink;
- WRITE_HTML("<area shape=\"rectangle\" coords=\"0,0, ", exportDoc.width, ",", exportDoc.height, "\" ");
- WRITE_HTML("href=\"", curImagemap.href, "\"");
- if (curImagemap.hasTargetText) {
- WRITE_HTML("\n target=\"", curImagemap.targetText, "\"");
- }
- var altText = exportDoc.altText;
- if (altText!="") {
- WRITE_HTML(" title=\"", altText, "\"");
- WRITE_HTML(" alt=\"", altText, "\"");
- }
- WRITE_HTML(">\n");
- }
-
- WRITE_HTML("</map>\n")
- WRITE_HTML("\n");
-
- WRITE_HTML_COMMENT(" Image Map created with Macromedia Fireworks 2.0 ")
- }
-
- WRITE_HTML("\n")
-